import 'package:flutter/material.dart';
import 'package:lucky_guy/global.dart';

class FormText extends StatefulWidget {
  FormText({
    Key key,
    @required this.hintText,
    @required this.controller,
    @required this.onChanged,
  }) : super(key: key);
  final String hintText;
  final controller;
  final onChanged;

  @override
  State<StatefulWidget> createState() => _FormTextState();
}

class _FormTextState extends State<FormText> {
  String text;
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.fromLTRB(10, 10, 15, 11),
      decoration: BoxDecoration(
        color: Global.backgroundColor.withOpacity(0.2),
        borderRadius: BorderRadius.all(Radius.circular(7)),
      ),
      child: ConstrainedBox(
        constraints: BoxConstraints(),
        child: TextField(
          controller: widget.controller,
          style: TextStyle(
            color: Global.backgroundColor,
            fontSize: 14,
          ),
          decoration: InputDecoration.collapsed(
            hintText: widget.hintText,
            hintStyle: TextStyle(
              color: Global.backgroundColor.withOpacity(0.5),
              fontSize: 14,
            ),
          ),
          onChanged: widget.onChanged,
        ),
      ),
    );
  }
}
